package hang.study.uistudy;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.MultiAutoCompleteTextView;

/**
 * Created by hang on 2015-10-7.
 */
public class TestAutoCompleteActivity extends Activity {

    String[] books = new String[]{
            "sdsfa",
            "风光Java讲义",
            "疯狂Android讲义",
            "送来的房价快速翻",
            "事都发生了",
            "教科书地方"
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.test_autocomplete_layout);

        ArrayAdapter<String> aa = new ArrayAdapter<String>(this,
                android.R.layout.simple_dropdown_item_1line,books);

        AutoCompleteTextView act = (AutoCompleteTextView)findViewById(R.id.autoComplete);
        act.setAdapter(aa);

        MultiAutoCompleteTextView mat = (MultiAutoCompleteTextView)findViewById(R.id.multiComplete);
        mat.setAdapter(aa);
        mat.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());


    }
}
